-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[UI/#305] 캘린터 터치 영역 수정 #311
base: develop
Are you sure you want to change the base?
Conversation
- TerningCalendarModel 도입 - 기존 static 함수 제거 - MonthModel 및 DayModel 코드 정리
- 월, 주, 일 표시 컴포넌트 재구현 - DayModel 함수 추가
- 페이징 컴포넌트 재구현 - 헤더 컴포넌트 이름 변경
- 요일 enum 추가 - 컴포넌트 주석 추가 - 미사용 라이브러리 제거
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전보다 코드가 훨씬 간결해진 것 같아요!! 리뷰하다가 이마 탁 치고 갑니다 .. ㄷㄷ
수고했어용~!!
/** 달력 <-> 목록 전환 컴포저블 */ | ||
@Composable | ||
private fun CalendarListTransition( | ||
transition: Transition<Boolean>, | ||
calendarModel: TerningCalendarModel, | ||
pagerState: PagerState, | ||
onNavigateToAnnouncement: (Long) -> Unit, | ||
onNavigateUpToCalendar: () -> Unit, | ||
calendarContent: @Composable () -> Unit, | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
함수화를 해놓으니 훨씬 가독성이 좋아졌네요!
|
||
fun updateListVisibility(value: Boolean) = _uiState.update { currentState -> | ||
currentState.copy( | ||
isListEnabled = visibility | ||
isListEnabled = value | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
상태를 업데이트할 때 이렇게 표현식을 사용해도 되는군요..!
제가 잘 몰라서 그러는데 표현식으로 사용하는 것과 그냥 블록함수로 사용하는 것과의 차이점이 있을까요...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update라는 블록함수를 사용하면 Flow를 원자적으로 업데이트한다고 합니다!
원자적이라는건 서로 다른 스레드에서 동시에 같은 객체를 업데이트하지 못하도록 보장하는 것입니다.
@Composable | ||
internal fun CalendarScrapCancelDialog( | ||
scrapVisibility: Boolean, | ||
internshipAnnouncementId: Long?, | ||
onDismissCancelDialog: (Boolean) -> Unit, | ||
) { | ||
if (scrapVisibility) { | ||
internshipAnnouncementId?.run { | ||
ScrapCancelDialog( | ||
internshipAnnouncementId = this, | ||
onDismissRequest = onDismissCancelDialog | ||
) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
코드를 보다가 든 궁금증인데,, 다이얼로그의 가시 여부를 담당하는 if문을 호출부에서 명시적으로 넣는것이 아니라 위처럼 함수 안에서 관리해주는 것이 더 나을까요...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
다이얼로그 관련된 로직을 한 곳에서 관리하는게 좋지 않을까 싶었는데, 또 생각해보면 Screen 파일에서 일관성있게 관리해주는 것도 좋을 것 같네요!
이 부분은 고민을 더 해보겠습니다~!
@Composable | ||
internal fun CalendarMonthGroup( | ||
dayModels: List<List<DayModel>>, | ||
isWeekEnabled: Boolean, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제 피알 머지하면 요것두 immutable로 바꿔주세용 (빨리 머지해야겠다...)
.background(White) | ||
.padding(horizontal = 20.dp) | ||
|
||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
한 줄 공백 생긴 것 같아요..!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다!!!!
@@ -33,27 +27,23 @@ class CalendarViewModel @Inject constructor() : ViewModel() { | |||
} | |||
} | |||
|
|||
fun updateSelectedDate(date: LocalDate) = viewModelScope.launch { | |||
_uiState.update { currentState -> | |||
fun updateSelectedDate(value: DayModel) = _uiState.update { currentState -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update 함수들의 파라미터 이름을 value로 수정하신 이유가 궁금해요!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
함수명에서 무엇을 구현하는지 명시해뒀는데 굳이 한번 더 명시할 필요가 있을까 싶었고, 모든 flow 업데이트 함수를 일관되게 관리하고자 value라고 수정했습니다!
⛳️ Work Description
📸 Screenshot
20241212_._.mp4
20241212_._.mp4
20241212_._.mp4
📢 To Reviewers